<template>
  <div>
    <div class="common-layout">
    <el-container>
      <el-header style="width: 1500px;height: 400px;border: 2px solid silver;border-radius:20px">
        <table>
          <tr>
            <td><div style="width: 200px;height: 60px;background-color: red;border-radius: 20px;margin-left: -20px;"><span style="font-size: 35px;text-align: center;color: #fff;">{{SheepData.auricle}}</span></div></td>
          </tr>
          <br>
          <tr>
            <td>
              <span style="font-size: 25px;color:blue;">{{SheepData.buildingName}}</span>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <span style="font-size: 25px;color:blue;">电子耳号:</span>
              <span style="font-size: 25px;color:blue;">{{ SheepData.corpuscleAuricle }}</span>
            </td>
          </tr>
          <br>
        </table>
        <table>
          <tr>
            <td>品种:{{SheepData.sheepbreedName  }}</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>性别:<span v-if="SheepData.sheepSex==1">公</span>
              <span v-if="SheepData.sheepSex==2">母</span>
            </td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>父亲耳号:<el-tag type="primary">{{SheepData. dadEarNum }}</el-tag></td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>母亲耳号:<el-tag type="danger">{{SheepData.momEarNum  }}</el-tag></td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>出生日期:{{SheepData. birthDate }}</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>出生重:{{SheepData. birthWeight }}公斤</td>
          </tr>
          <br>
          <tr>
          <td>出生场地:{{SheepData.birthAdd  }}</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>断奶日期:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>断奶重:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>日龄:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>月龄:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>同胎数:</td>
          </tr>
          <br>
          <tr>
          <td>生产等级:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>基因等级:<span v-if="SheepData.geneLV==1">后备级</span>
              <span v-if="SheepData.geneLV==2">核心级</span>
              <span v-if="SheepData.geneLV==3">生产级</span>
              <span v-if="SheepData.geneLV==4">未定级</span></td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>销售等级:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>繁殖方法:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </tr>
          <br>
          <tr>
          <td>当前胎次:0</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>已产胎次:0</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>配种序号:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </tr>
          <br>
          <tr>
          <td>创建人:张三</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>修改人:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>创建时间:{{ SheepData.birthDate }}</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <td>修改时间:</td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </tr>
        </table>
      </el-header>
      <el-main style="width: 1500px;height: 700px;border: 2px solid silver;border-radius:20px;margin-top: 20px;">
        <el-radio-group v-model="form.radio1" size="large" style="margin-left: 450px;">
      <el-radio-button label="系谱" value="1" />
      <el-radio-button label="生产记录" value="2" />
      <el-radio-button label="转舍记录" value="3" />
      <el-radio-button label="健康记录" value="4" />
      <el-radio-button label="档案卡" value="5" /> 
    </el-radio-group>
    
   <div v-if="form.radio1==1" style="width: 1455px;height: 700px;background-color:pink;">
    <h3 style="color: blue;">系谱信息</h3>
      <el-input v-model="form.EarNum"  style="width: 150px; margin-top: 300px; margin-left: 100px;" disabled  />
      <el-input v-model="form.DadNum"  style="width: 150px; margin-top: 100px;margin-left: 150px;"  disabled >
        <span v-if="form.DadNum==''">form.DadNum='无'</span>
        </el-input>
      <el-input v-model="form.MomNum"  style="width: 150px; margin-bottom: -500px;margin-left: -150px;" disabled />
      <el-input v-model="form.DadGrandDadNum"  style="width: 150px; margin-top: -150px; margin-left: 100px;" disabled  />
      <el-input v-model="form.DadGrandMomNum"  style="width: 150px; margin-top: 250px; margin-left: -150px;" disabled  />
      <el-input v-model="form.MomGrandDadNum"  style="width: 150px; margin-top: 350px; margin-left: -150px;" disabled  />
      <el-input v-model="form.MomGrandMomNum"  style="width: 150px; margin-bottom: -700px;margin-left: -150px;" disabled />
   </div>
      </el-main>
    </el-container>
  </div>
  </div>
</template>

<script setup lang="ts">
import {onMounted, reactive, ref} from 'vue'
import axios from 'axios';
import {useRoute} from 'vue-router'
import router from '@/router';
const route = useRoute()

const form = reactive({
  radio1:0,
  EarNum:'',
  DadNum:"无",
  MomNum:"无",
  Dadid:'',
  Momid:'',
  MomGrandDadNum:"无",
  MomGrandMomNum:"无",
  DadGrandDadNum:"无",
  DadGrandMomNum:"无",
})
onMounted(()=>{
  GetList();
})
const SheepData=ref([])
function GetList()
{
  axios.post("http://localhost:5012/api/SheepFile/SheepFileList",{
    breedingSheepArchiveId:route.query.BreedingSheepArchiveId
  })
  .then(res=>{
    console.log(res);
    SheepData.value=res.data.data[0];
    SheepData.value.birthDate = res.data.data[0].birthDate.substring(0,10)
    form.EarNum=SheepData.value.auricle
    form.DadNum=SheepData.value.dadEarNum
    form.MomNum=SheepData.value.momEarNum
    form.Dadid = SheepData.value.dadBreedingSheepArchiveId
    form.Momid = SheepData.value.momBreedingSheepArchiveId
    GetMompedigree();
    GetDadpedigree();
  })
}
//获取母亲耳号系谱
const MomData=ref([])
function GetMompedigree()
{
  axios.post("http://localhost:5012/api/SheepFile/SheepFileList",{
    breedingSheepArchiveId:form.Momid
  })
  .then(res=>{
    console.log("获取母亲耳号系谱",res)
    MomData.value = res.data.data[0]
    form.MomGrandDadNum = MomData.value.momEarNum
    form.MomGrandDadNum = MomData.value.dadEarNum
  })

}
//获取父亲耳号系谱
function GetDadpedigree()
{
  axios.post("http://localhost:5012/api/SheepFile/SheepFileList",{
    breedingSheepArchiveId:form.Dadid
  })
  .then(res=>{
    console.log("获取父亲耳号系谱",res)
    MomData.value = res.data.data[0]
    form.DadGrandDadNum = MomData.value.dadEarNum
    form.DadGrandMomNum = MomData.value.momEarNum
  })
}

</script>

<style scoped>

</style>